package jp.co.toshiba.ffsa.form.csas;

import jp.co.toshiba.ffsa.form.BaseForm;

import org.seasar.struts.annotation.Arg;
import org.seasar.struts.annotation.Mask;
import org.seasar.struts.annotation.Maxlength;
import org.seasar.struts.annotation.Minlength;
import org.seasar.struts.annotation.Msg;
import org.seasar.struts.annotation.Required;
import org.seasar.struts.annotation.Validwhen;

/**
 * (パスワード変更警告)パスワード変更入力
 * @author npc
 */
public class Csas402Form extends BaseForm {

    /** 現パスワード */
    @Required(msg=@Msg(key="errors.required", resource=true), arg0=@Arg(key="current_password", resource=true))
    @Maxlength(maxlength=12, msg=@Msg(key="errors.maxlength", resource=true), arg0=@Arg(key="current_password", resource=true), arg1=@Arg(key="12", resource=false))
    @Mask(mask="^[a-zA-Z0-9]+$", msg=@Msg(key="errors.emcharacter", resource=true), arg0=@Arg(key="current_password", resource=true))
    public String currentPassword;
    /** 新パスワード */
    @Required(msg=@Msg(key="errors.required", resource=true), arg0=@Arg(key="new_password", resource=true))
    @Maxlength(maxlength=12, msg=@Msg(key="errors.maxlength", resource=true), arg0=@Arg(key="new_password", resource=true), arg1=@Arg(key="12", resource=false))
    @Minlength(minlength=8, msg=@Msg(key="errors.minlength", resource=true), arg0=@Arg(key="new_password", resource=true), arg1=@Arg(key="8", resource=false))
    @Mask(mask="^[a-zA-Z0-9]+$", msg=@Msg(key="errors.emcharacter", resource=true), arg0=@Arg(key="new_password", resource=true))
    public String newPassword;
    /** 新パスワード再入力 */
    @Required(msg=@Msg(key="errors.required", resource=true), arg0=@Arg(key="Reenter_new_password", resource=true))
    @Maxlength(maxlength=12, msg=@Msg(key="errors.maxlength", resource=true), arg0=@Arg(key="Reenter_new_password", resource=true), arg1=@Arg(key="12", resource=false))
    @Mask(mask="^[a-zA-Z0-9]+$", msg=@Msg(key="errors.emcharacter", resource=true), arg0=@Arg(key="Reenter_new_password", resource=true))
    @Validwhen(test="(((*this* == null) or (newPassword == null)) or (((*this* != null) and (newPassword != null)) and (*this* == newPassword)))", msg=@Msg(key="errors.password_mismatch", resource=true))
    public String reEnterNewPassword;

    /** メニュー表示(空白：表示 それ以外：非表示) */
    public String dispMenuFlag;
    /**
     * 初期化処理
     */
    public void reset(){
        this.currentPassword    = "";
        this.newPassword        = "";
        this.reEnterNewPassword = "";
    }
}
